//引入项目中所有的全局组件
import SvgIcon from './SvgIcon/index.vue'
import RoundImage from './RoundImage/index.vue'
//svg图
import welcom from '@/assets/icons/welcome.svg'
//引入element-plus图标
import {
  Promotion,
  Avatar,
  HomeFilled,
  Platform,
  User,
  Goods,
  ChromeFilled,
  Lock,
  UserFilled,
  Monitor,
  FullScreen,
  Setting,
  Expand,
  Fold,
  ArrowDown,
  Search,
  ArrowRight,
  Refresh,
  Plus,
  Edit,
  Delete,
  ZoomIn,
} from '@element-plus/icons-vue'

//自定义组件注入全局使用
const allGloablComponent: any = {
  SvgIcon,
  RoundImage,
}
//注入全局图标
const allGloablIcons: any = {
  Promotion,
  Avatar,
  HomeFilled,
  Platform,
  User,
  Goods,
  ChromeFilled,
  Lock,
  UserFilled,
  Monitor,
  FullScreen,
  Setting,
  Expand,
  Fold,
  ArrowDown,
  Search,
  ArrowRight,
  Refresh,
  Plus,
  Edit,
  Delete,
  ZoomIn,
  welcom,
}
//合并对象
const allGloabObject = Object.assign({}, allGloablComponent, allGloablIcons)

export default {
  install(app: any) {
    Object.keys(allGloabObject).forEach((key) => {
      //遍历注册全局组件
      app.component(key, allGloabObject[key])
    })
  },
}
